<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>订单列表</title>
    <link rel="stylesheet" type="text/css" href="${basePath}/public/css/common.css">
    <script type="text/javascript" src="${basePath}/public/js/PCASClass.js"></script>
    <script type="text/javascript" src="${basePath}/public/js/jquery.min.js"></script>
    <script type="text/javascript" src="${basePath}/public/js/webuploader.min.js"></script>
    <script type="text/javascript">
        window.onload=function(){
            //初始化省市区
            var mypcas = new PCAS("txtProvince,所属省份","txtCity,所属城市","txtArea,所属地区");
        }

        //初始化Web Uploader
        var uploader ;
        $(function(){
            uploader = WebUploader.create({
                // 选完文件后，是否自动上传。
                auto: true,
                // swf文件路径
                swf: '${pageContext.request.contextPath}/public/js/Uploader.swf',
                // 文件接收服务端。
                server:'${basePath}/admin/work/toFile',
                // 选择文件的按钮。可选。
                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                pick: '#images',
                //设置文件上传域的name
                fileVal:"fileImg",

                //文件上传请求的参数表，每次发送都会发送此对象中的参数
                formData:{
                },
                // 只允许选择图片文件。
                accept: {
                    title: 'Images',
                    extensions: 'gif,jpg,jpeg,bmp,png',
                    mimeTypes: 'image/*'
                }
            });

            //上传图片完成后回调的方法
            uploader.on('uploadSuccess', function(file,response) {
                //服务器返回json数据
                console.info(response);
                //将上传的文件路径绑定在页面中
                $("#imageList").append("<img src='"+response.url+"' style='width:100px;height:100px;' />"
                    +"<input type='hidden' name='imgfile' value='"+response.url1+"'/>"
                );
            });

        });

        function button() {
            var id = $("#id").val();
            var username = $("#username").val();
            var phone = $("#phone").val();
            var email = $("#email").val();
            var goodsImg = $(":input[name='imgfile']").val();

            $.ajax({
                url:"${basePath}/home/vipUser/Proinfo",
                type:"post",
                data:{
                    id:id,
                    username:username,
                    email:email,
                    userImg:goodsImg,
                    phone:phone
                },
                success:function (resultJson) {
                    if (resultJson.status==1){
                        alert("修改成功")
                        window.location.href="${basePath}/home/vipUser/index";
                    } else {
                        alert("修改失败");
                    }
                }
            })
        }
    </script>
</head>
<body>
<div class="top-header">
    <div class="section">
        <div class="top-header-left f-left">
            <a href="#">LOGO</a>
        </div>
        <div class="top-header-right f-right">
            <c:choose>
                <c:when test="${empty user}">
                    <a href="${basePath}/home/vipUser/toLogin">登录</a>
                    <a href="${basePath}/home/vipUser/toRegisterVip">注册</a>
                    <a href="${basePath}/admin/adminUser/toLogin">后台</a>
                </c:when>
                <c:otherwise>
                    <a href="#">欢迎你!<W style="color: bisque;font-weight: bold; font-family: 微软雅黑; font-size: 20px;">${user.username}</W></a>
                    <a href="${basePath}/admin/adminUser/toLogin">后台</a>
                    <a href="${basePath}/home/vipUser/write">注销</a>
                </c:otherwise>
            </c:choose>
        </div>
    </div>
</div>

<div class="section nav-header">
    <ul class="nav-menus f-left">
        <li><a href="${basePath}/home/homepage/index">首页</a></li>
        <li><a href="${basePath}/home/homepage/toProductList" >产品列表</a></li>
        <li><a href="${basePath}/home/cart" >购物车</a></li>
        <li><a href="${basePath}/home/vipUser/index" >会员中心</a></li>
        <li><a href="${basePath}/home/News/toNews">新闻资讯</a></li>
        <li><a href="${basePath}/home/pay/contact">联系我们</a></li>
    </ul>
    <div class="f-right nav-right">
        <input type="text" class="seacher-input f-left" placeholder="输入关键字">
        <a class="seacher-but  f-left" onclick="select()">搜索</a>
    </div>
</div>

<div class="section clearfix" style="margin-top: 10px;">
    <!--页面左边-->
    <div class="left-260">
        <div class="bg-wrap">
            <div class="avatar-box">
                <a class="img-box" href="${basePath}/home/vipUser/index">
                    <img src="${basePath}/public/images/${sessionScope.userImg}">
                </a>
                <h3>
                    ${sessionScope.username}
                </h3>
                <p><b>注册会员</b></p>
            </div>
            <div class="center-nav">
                <ul>
                    <li>
                        <h2>
                            <i class="iconfont icon-order"></i>
                            <span>订单管理</span>
                        </h2>
                        <div class="list">
                            <p><a href="${basePath}/home/ShopOrder/orderList"><i class="iconfont icon-arrow-right"></i>交易订单</a></p>
                            <p><a href="${basePath}/home/UserAddress/index"><i class="iconfont icon-arrow-right"></i>收货地址</a></p>
                        </div>
                    </li>
                    <li>
                        <h2>
                            <i class="iconfont icon-amount"></i>
                            <span>余额管理</span>
                        </h2>
                        <div class="list">
                            <p><a href="${basePath}/home/vipUser/toRecharge"><i class="iconfont icon-arrow-right"></i>账户充值
                            <p><a href="${basePath}/admin/rechargeLog/ServletRecharge"><i class="iconfont icon-arrow-right"></i>充值记录</a></p>
                        </div>
                    </li>
                    <li>
                        <h2>
                            <i class="iconfont icon-user"></i>
                            <span>账户管理</span>
                        </h2>
                        <div class="list">
                            <p><a href="${basePath}/home/vipUser/toProinfo"><i class="iconfont icon-arrow-right"></i>账户资料</a></p>
                            <p><a href="${basePath}/home/vipUser/ToUpdatePassword"><i class="iconfont icon-arrow-right"></i>修改密码</a></p>
                            <p><a href="${basePath}/home/vipUser/write"><i class="iconfont icon-arrow-right"></i>退出登录</a></p>
                        </div>
                    </li>
                </ul>
            </div>

        </div>
    </div>
    <!--/页面左边-->

    <!--页面左边-->
    <div class="right-auto">
        <div class="bg-wrap" style="min-height:765px;">


            <div class="sub-tit " style="margin: 0px;">
                <a class="add" href="javascript:history.go(-1);"><i class="iconfont icon-reply"></i>返回</a>
                <ul>
                    <li class="selected">
                        <a href="javascript:;">账号资料</a>
                    </li>
                </ul>
            </div>


            <div class="form-box">
                <c:forEach items="${list}" var="m">
                <dl class="form-group">
                    <dt>用户id：</dt>
                    <dd id="id">
                        ${m.id}
                    </dd>
                </dl>
                <dl class="form-group">
                    <dt>昵称：</dt>
                    <dd>
                        <input name="txtNickName" id="username" type="text" class="input" value="${m.username}" datatype="*" sucmsg=" ">
                </dl>

                <dl class="form-group">
                    <dt>头像：</dt>
                    <dd>
                        <div id="imageList"></div>
                        <div id="images">更换图片</div>
                    </dl>


                <dl class="form-group">
                    <dt>性别：</dt>
                    <dd>
                        <label class="mart"><input name="rblSex" type="radio" value="男" checked="checked">男</label>
                        <label class="mart"><input name="rblSex" type="radio" value="女">女</label>
                        <label class="mart"><input name="rblSex" type="radio" value="保密" datatype="*" sucmsg=" ">保密<span class="Validform_checktip Validform_right"> </span></label>

                    </dd>
                </dl>
                <dl class="form-group">
                    <dt>邮箱：</dt>
                    <dd>
                        <input name="txtEmail" id="email" type="text" class="input" value="${m.email}" datatype="e" sucmsg=" ">
                </dl>
                <dl class="form-group">
                    <dt>手机：</dt>
                    <dd>
                        <input name="txtMobile" id="phone" type="text" class="input" value="${m.phone}" datatype="m" sucmsg=" ">
                </dl>
                <dl class="form-group">
                    <dt>电话：</dt>
                    <dd>
                        <input name="txtTelphone" id="txtTelphone" type="text" class="input" maxlength="30" value="">
                    </dd>
                </dl>
                <dl class="form-group">
                    <dt>所属地区：</dt>
                    <dd>
                        <select id="Province" name="txtProvince" class="select"></select>
                        <select id="txtCity" name="txtCity" class="select"></select>
                        <select id="txtArea" name="txtArea" class="select" datatype="*" sucmsg=" "></select>
                </dl>
                <dl class="form-group">
                    <dt>详细地址：</dt>
                    <dd>
                        <input name="txtAddress" id="txtAddress" type="text" class="input" maxlength="250" value="">
                    </dd>
                </dl>
                <dl class="form-group">
                    <dt>在线QQ：</dt>
                    <dd>
                        <input name="txtQQ" id="txtQQ" type="text" class="input" maxlength="20" value="">
                    </dd>
                </dl>
                <dl class="form-group">
                    <dt>MSN账户：</dt>
                    <dd>
                        <input name="txtMsn" id="txtMsn" type="text" class="input" maxlength="20" value="">
                    </dd>
                </dl>
                <dl class="form-group">
                    <dd>
                        <input id="btnSubmit" name="btnSubmit" type="submit" value="确认修改" class="submit" onclick="button()">
                    </dd>
                </dl>
                </c:forEach>
            </div>


        </div>
    </div>
    <!--/页面左边-->
</div>

</body>
</html>
